import {
  FormController,
  IFormDetailContainerController,
  IFormDetailProvider,
} from '@ibiz-template/runtime';
import { IDEFormDetail } from '@ibiz/model-core';
import { FormSearchItemController } from './controller';

/**
 * 表单搜索项适配器
 *
 * @export
 * @class FormSearchItemProvider
 * @implements {IFormDetailProvider}
 */
export class FormSearchItemProvider implements IFormDetailProvider {
  component: string = 'FormSearchItem';

  async createController(
    detailModel: IDEFormDetail,
    form: FormController,
    parent: IFormDetailContainerController | undefined,
  ): Promise<FormSearchItemController> {
    const c = new FormSearchItemController(detailModel, form, parent);
    await c.init();
    return c;
  }
}
